<?php
	namespace Application\Home\Controller;
	use Application\Home\Model\Article as ArticleModel;
	use Application\Home\Model\Articlecat;
	class Article{
		
		public function index(){
			
//			文章端口：
//			首页关于id=1;
//			关于页面id=2;
//			传世页面id=3;
//			var_dump($_GET);exit;
//			$id = $_POST['id'];
//			$id = 1;

			$cat = new Articlecat();
			
			$Articlecat = $cat->order('id asc')->select();

			$id = $Articlecat[0]['id'];
			
			$article = new ArticleModel();

			$data = $article->where("article_class= $id")->field('img_name,img_src,article,href')->order('sort asc')->select();

			$json = json_encode($data);

			echo $json;
			
		}
		
		public function about(){
			
			$cat = new Articlecat();
			
			$Articlecat = $cat->order('id asc')->select();

			$id = $Articlecat[1]['id'];			
			

			$article = new ArticleModel();

			$data = $article->where("article_class= $id")->field('img_src,article')->order('sort asc')->select();

			$json = json_encode($data);
			
			echo $json;
			
		}	
		
		public function chuanshi(){
			
			$cat = new Articlecat();
			
			$Articlecat = $cat->order('id asc')->select();

			$id = $Articlecat[2]['id'];			

			$article = new ArticleModel();

			$data = $article->where("article_class= $id")->field('img_name,img_src,article')->order('sort asc')->select();
			$json = json_encode($data);
			
			echo $json;
			
		}		
		
	}
?>